import request from "@/utils/request";

// 获取状态下拉列表
export function getStatusList() {
	return request({
		url: "/operation/web/operationWorkOrderStatistics/statusList",
		method: "get",
	});
}

// 查询工单统计列表
export function listWorkOrderStatistics(params) {
	return request({
		url: "/operation/web/operationWorkOrderStatistics/list",
		method: "get",
		params,
	});
}

// 获取工单统计详细信息
export function getWorkOrderStatistics(id) {
	return request({
		url: `/operation/web/operationWorkOrderStatistics/${id}`,
		method: "get",
	});
}

// 处理工单
export function handleWorkOrder(data) {
	return request({
		url: "/operation/web/operationWorkOrderStatistics/handle",
		method: "post",
		data,
	});
}

export function finishWorkOrder(id) {
	return request({
		url: `/operation/web/operationWorkOrderStatistics/finish/${id}`,
		method: "get",
	});
}

// 工单数量统计
export function countWorkOrderStatistics(params) {
	return request({
		url: "/operation/web/operationWorkOrderStatistics/count",
		method: "get",
		params,
	});
}

// 工单类型分布
export function getTypeDistribution(params) {
	return request({
		url: "/operation/web/operationWorkOrderStatistics/typeDistribution",
		method: "get",
		params,
	});
}

// 工单趋势分析
export function getTrendAnalysis(params) {
	return request({
		url: "/operation/web/operationWorkOrderStatistics/trendAnalysis",
		method: "get",
		params,
	});
}

// 部门完成率
export function getDepartmentCompletionRate(params) {
	return request({
		url: "/operation/web/operationWorkOrderStatistics/departmentCompletionRate",
		method: "get",
		params,
	});
}

// 新增工单统计
export function addOperationWorkOrderStatistics(data) {
	return request({
		url: "/operation/web/operationWorkOrderStatistics",
		method: "post",
		data: data,
	});
}

// 修改工单统计
export function updateOperationWorkOrderStatistics(data) {
	return request({
		url: "/operation/web/operationWorkOrderStatistics",
		method: "put",
		data: data,
	});
}

// 获取用户下拉列表
export function getUserList() {
	return request({
		url: "/operation/web/schedules/userList",
		method: "get",
	});
}
